<link href="__PUBLIC__/css/daterangepicker.css" rel="stylesheet">
<script src="__PUBLIC__/js/daterangepicker/daterangepicker.js"></script>
<form class="form-horizontal" id="status_form1" action="{:U('setting/workruleedit')}" method="post">
	<input type="hidden" name="id" value="{$workrule_info['id']}" />
	<input type="hidden" name="status" value="1" />
	<table class="table" style="border:none;">
		<tr>
			<td style="border:none;text-align:right">日期：</td>
			<td style="border:none;">
				<if condition = "$_GET['rule_id'] neq ''">
					<input onclick="WdatePicker()" class="form-control required Wdate" aria-required="true" type="text" id="start_date" name="sdate" value="{$workrule_info['sdate']}" />
					<!-- <input class="form-control required Wdate valid" aria-required="true" type="text" id="start_date" name="sdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd', maxDate:&quot;#F{$dp.$D('end_date')||'2038-01-01'}&quot;})" value="{$workrule_info['sdate']}" aria-invalid="false"> -->
				<else />
					<input type="text" name="between_date" class="form-control" id="reservation" value="{$workrule_info['sdate']}" style="width: 80%;float: left;"/>
					<i class="glyphicon glyphicon-calendar fa fa-calendar reservation" style="float: left;bottom: 10px;right: 24px;top: 10px;cursor: pointer;"></i>
				</if>
			</td>
		</tr>
		<tr>
			<td style="border:none;text-align:right">设置为：</td>
			<td style="border:none;">
				<div class="radio radio-info radio-inline">
					<input type="radio" name="type" id="type1" <if condition = "$workrule_info['type'] eq 1 || $workrule_info['type'] eq ''">checked</if> value="1" style="position: inherit;margin-left: 0px;">
					<label for="type1">休息</label>
				</div>
				<div class="radio radio-info radio-inline">
					<input type="radio" name="type" id="type2" <if condition = "$workrule_info['type'] eq 2">checked</if> value="2" style="position: inherit;margin-left: 0px;">
					<label for="type2">工作日</label>
				</div>
			</td>
		</tr>
	</table>
</form>
<script>
	//时间插件
    $('#reservation').daterangepicker({
    	<if condition = "$workrule_info['sdate']">
    	// alert($workrule_info["sdate"]);
			startDate:"{$workrule_info['sdate']}",
			endDate:"{$workrule_info['edate']}",
		</if>
		// startDate: moment().startOf('day'), 
  		// endDate: moment(), 
         
        //minDate: '01/01/2012',    //最小时间  
        // maxDate : moment(), //最大时间
        showDropdowns : true,  
        showWeekNumbers : false, //是否显示第几周  
        // timePicker : true, //是否显示小时和分钟  
        // timePickerIncrement : 60, //时间的增量，单位为分钟  
        timePicker12Hour : false, //是否使用12小时制来显示时间  
        showShortcuts : false,
        ranges : {  
            //'最近1小时': [moment().subtract('hours',1), moment()],  
            '今日': [moment().startOf('day'), moment()],  
            '昨日': [moment().subtract('days', 1).startOf('day'), moment().subtract('days', 1).endOf('day')],  
            '最近7日': [moment().subtract('days', 6), moment()],  
            '最近30日': [moment().subtract('days', 29), moment()]  
        },  
        opens : 'right', //日期选择框的弹出位置  
        buttonClasses : [ 'btn btn-default' ],  
        applyClass : 'btn-small btn-primary blue',  
        cancelClass : 'btn-small', 
        separator : ' to ',  
        locale : {  
            applyLabel : '确定',  
            cancelLabel : '取消',  
            fromLabel : '起始时间',  
            toLabel : '结束时间',  
            customRangeLabel : '自定义',  
            daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],  
            monthNames: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],
            firstDay : 1 ,
            format : 'YYYY-MM-DD', //控件中from和to 显示的日期格式
        },
        "alwaysShowCalendars": true,
        function(start, end, label) {
        	//回调
        	$('#reservation').val(start.format('YYYY-MM-DD HH:mm:ss') + ' - ' + end.format('YYYY-MM-DD HH:mm:ss'))
  			// console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
    	}
    });
</script>